package demo;

import net.kano.joscar.flapcmd.SnacCommand;
import net.kano.joscar.snac.SnacRequestListener;
import net.kano.joscar.snac.SnacRequestSentEvent;
import net.kano.joscar.snac.SnacRequestTimeoutEvent;
import net.kano.joscar.snac.SnacResponseEvent;
import net.kano.joscar.snaccmd.CertificateInfo;
import net.kano.joscar.snaccmd.loc.UserInfoCmd;

public class getInfoListener implements SnacRequestListener {

	@Override
	public void handleResponse(SnacResponseEvent e) {
		SnacCommand cmd = e.getSnacCommand();
		
		System.out.println("\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!\n" + e.getSnacPacket().getData() + "\n" +
				cmd.toString());
		
		UserInfoCmd uic = (UserInfoCmd) cmd;

        String sn = uic.getUserInfo().getScreenname();
        System.out.println("user info for " + sn + ": "
                + uic.getInfoData());

        CertificateInfo certInfo = uic.getInfoData().getCertificateInfo();		
        //System.out.println(certInfo.toString());
        
	}

	@Override
	public void handleSent(SnacRequestSentEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void handleTimeout(SnacRequestTimeoutEvent e) {
		// TODO Auto-generated method stub

	}

}
